const {ccclass, property} = cc._decorator;

@ccclass
export default class ItemTs extends cc.Component {

    @property(cc.Label)
    labelNum:cc.Label = null;
    @property(cc.Label)
    selFrame: cc.Label = null;
    @property(cc.Node)
    layerCom:cc.Node = null;
    
    public data:any;

    onLoad()
    {
        this.set_SelFrame(false);
    }

    // use this for initialization
    itemDataAssignment(obj,tableviewUtils){
        this.data = obj;
        this.Refresh_view();
    }

    Refresh_view()
    {
        var itemData = this.data.itemData;
        this.labelNum.string= itemData.labelNum;
        this.set_SelFrame(itemData.isSel);
    }

    set_SelFrame(isSel)
    {
        this.selFrame.node.active = isSel;
    }

    onClickItem()
    {
        var _layerCom:any = this.layerCom.getComponent(cc.Component);
        if(_layerCom && this.data)
        {
            _layerCom.onClickItem(this.data.index);
        }
    }
}
